package com.tangsm.spring.mvc.mybatis.domain.entity;


import jakarta.validation.Valid;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;

/**
 * 图书实体
 */
@Valid
public class Book {

	/**
	 * 图书ID
	 */
	@NotNull(message = "图书ID不能为空")
	private long bookId;

	/**
	 * 图书名称
	 */
	@Min(value = 2)
	@Max(value = 8)
	@NotNull(message = "图书名称不能为空")
	private String name;

	/**
	 * 馆藏数量
	 */
	@Min(value = 0)
	@Max(value = 1000)
	@NotNull(message = "馆藏数量不能为空")
	private int quantity;

	public long getBookId() {
		return bookId;
	}

	public void setBookId(long bookId) {
		this.bookId = bookId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	@Override
	public String toString() {
		return "Book{" +
				"bookId=" + bookId +
				", name='" + name + '\'' +
				", quantity=" + quantity +
				'}';
	}
}
